import dayjs from "dayjs";
import { ITask } from "./tokens";

export class RestTask implements ITask {
    name: string = `RestTask`
    title: string = `休息任务`;
    order: number = 0;
    async getCode(): Promise<any> {
        return {
            name: this.name,
            code: `toastLog('正在休息...')`,
            loopTimes: 1,
            interval: 0
        };
    }
    start(paylaod: any) {}
    canRun() {
        const hour = dayjs().get('hour')
        return hour > 0 && hour < 8;
    }
    async finish(uuid: string): Promise<any> {
        return;
    }
    isFinishSign(event: string) {
        return event === `REST_TASK_FINISH`
    }
}